<?php
require "DL/db.class.php";

class Users{

    private $username;
    private $password;

//   function __construct($username,$password) {
//      $this->username = $username;
//      $this->password = $password;
//
//   }
   function addUser($info){//takes an array as input

   }
   function getUserByUserID($user_id) {
       $dlo= new db();
       $dlo->connect();
       $dlo->select("users", "fname as First_Name, lname as Last_Name, email, phone", "user_id=$user_id");
       return $dlo->getResult();


   }
   function getUserByUserUserName(){

   }
   function UpdateUserByUserID($user_id){


   }
   function deleteUserByUseID($user_id){

   }
   function searchUserByUserName($first_name=null,$last_name=null){

   }
   function userLogin($username, $password){
       $dlo= new db();
       $dlo->connect();
       if($dlo->select("users LEFT JOIN user_role ON users.role_type_id=user_role.role_id","*","users.user_name = '$username'")):
                $result=$dlo->getResult();
                if(md5($password)==$result['pass']):
                        $_SESSION=$dlo->getResult();
//                        echo "<pre>";
//                        print_r($_SESSION);
//                        die();
                    return true;
                else:
                        return false;
                endif;
       else:
            return false;

       endif;

       


   }

}
?>
